class Libxml2Error(Exception):
    """
        Some versions of libxml2 fail to retain custom namespaces when they
        parse HTML. Since custom namespaces are what Cotton is sort of all about,
        this is pretty annoying.
        """
    def __init__(self, test_text, test_output, message):
        self.test_text   = str(test_text).split("\n")
        self.test_output = str(test_output).split("\n")
        self.message     = str(message)
    def __str__(self):
        full_message = self.message

        full_message = full_message + "\n----- original test text -----"
        for line in self.test_text:
            full_message = full_message + "\n    " + str(line)

        full_message = full_message + "\n----- processed test text -----"
        for line in self.test_output:
            full_message = full_message + "\n    " + str(line)

        full_message = full_message + "\n----- end -----"

        return full_message

class CottonError(Exception):
    def __init__(self, message):
        self.message = str(message)
    def __str__(self):
        return self.message

class CottonExpressionError(CottonError):
    pass
